import React, {Component} from 'react';
import './App.css';
import {connect} from 'react-redux'
import {bindActionCreators} from 'redux';
import * as productAction from  '../../actions/product'
import  {Redirect } from  'react-router-dom'

class App extends Component {
    render() {
        // console.log(this.props)
        if (this.props.isLogin) {
          return  <Redirect to="/productList"></Redirect>
        }
        return (
            <div className="App">
                <button onClick={this.props.loginAction}> 点击登录</button>
            </div>
        );
    }
}

const mapDispatchToProps = (dispatch) => {
    return {
        loginAction: bindActionCreators(productAction.loginAction, dispatch),
    }
};

export default connect((state) => state.name,mapDispatchToProps)(App);
